function Person(name, age) {
  // 实例属性
  this.name = name;
  this.age = age;

  // 实例属性
  this.getName = () => {
    return this.name;
  };
}

// 原型属性
Person.prototype.getAge = function () {
  return this.age;
};

var peter = new Person('peter', 26);

console.log(peter.getName());
console.log(peter.getAge());
console.log(Object.hasOwnProperty.call(peter, 'getName'));
console.log(Object.hasOwnProperty.call(peter, 'getAge'));
